package org.lboot.rbac.config;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @author  : Kindear
 * @date : 2021-11-15
 * Knife4j 文档配置 基于 SpringFox
 */
@Configuration
@EnableSwagger2WebMvc
@AllArgsConstructor
public class RbacKnife4jConfig {

//    @Bean(value = "rbacApi")
//    public Docket rbacApi() {
//        String groupName="权限管理";
//        ApiInfo apiInfo = new ApiInfoBuilder()
//                .title("RBAC管理文档")
//                .description("lucy-rbac 角色权限管理控制，基于SaToken")
//                .termsOfServiceUrl("http://localhost:8080")
//                .version("1.0.0")
//                .build();
//        return new Docket(DocumentationType.SWAGGER_2)
//                .host("http://localhost:8080/")
//                .apiInfo(apiInfo)
//                .groupName(groupName)
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("org.lboot.rbac.controller"))
//                .paths(PathSelectors.any())
//                .build();
//    }
    @Bean(value = "rbac2Api")
    public Docket rbac2Api() {
        String groupName="RBAC2";
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("RBAC2管理文档")
                .description("lucy-rbac 角色权限管理控制，基于SaToken")
                .termsOfServiceUrl("http://localhost:8080")
                .version("1.1.0")
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .host("http://localhost:8080/")
                .apiInfo(apiInfo)
                .groupName(groupName)
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.lboot.rbac.controller"))
                .paths(PathSelectors.any())
                .build();
    }

//    @Bean(value = "rbacPluginApi")
//    public Docket rbacPluginApi(){
//        String groupName="插件接口";
//        ApiInfo apiInfo = new ApiInfoBuilder()
//                .title("RBAC插件接口")
//                .description("角色权限管理控制依赖，基于SaToken")
//                .termsOfServiceUrl("http://localhost:8080")
//                .version("1.0.0")
//                .build();
//        return new Docket(DocumentationType.SWAGGER_2)
//                .host("http://localhost:8080/")
//                .apiInfo(apiInfo)
//                .groupName(groupName)
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("org.lboot.rbac.plugin"))
//                .paths(PathSelectors.any())
//                .build();
//    }
}
